export default {
  name: 'leftMoveDelete',
  data: function(){
    return {
      startX: 0,
      transX: 0,
      deleteW: 0
    }
  },
  mounted: function(){
  	var _this = this;
  	this.deleteW = $(this.$refs.deleteBox).width();
  	$(this.$refs.lmdItemBox).on("touchstart", function(ev){
  		ev = ev || event;
  		_this.startX = ev.targetTouches[0].clientX;
  	});
  	$(this.$refs.lmdItemBox).on("touchmove", function(ev){
  		ev = ev || event;
  		var moveX = ev.targetTouches[0].clientX;
  		var offX = moveX - _this.startX;
  		_this.transX = _this.transX + offX;
  		if(_this.transX > 0){
  			_this.transX = 0;
  		}else if(_this.transX < -_this.deleteW){
  			_this.transX = -_this.deleteW;
  		}else{
  			_this.startX = moveX;
  		}
  		$(this).css("transition", "transform 0s").css("transform", "translateX("+_this.transX+"px)");
	  });
  	$(this.$refs.lmdItemBox).on("touchend", function(ev){
  		if(_this.transX > -_this.deleteW/2){
  			_this.transX = 0;
  		}else{
  			_this.transX = -_this.deleteW;
  		}
  		$(this).css("transition", "transform 0.1s linear").css("transform", "translateX("+_this.transX+"px)");
  	});
  },
  methods: {
  	
  },
}